import { NavBar, Space, Toast } from "antd-mobile";
import { useNavigate, Link } from "react-router-dom";
import style from "./css/Home.module.css";
import { banner, hospitallist} from "./sevice/HomeList";
import React, { useState, useEffect } from "react";
// import Banner from '../app/component/Home/Banner'//轮播图
import Banner from "./component/banner";
import Cardlist from "./component/card"
// import { Swiper} from "antd-mobile";
import { Divider } from "antd-mobile";
// import { Grid } from 'antd-mobile'
import { Card,Button } from 'antd-mobile'
export default function () {
  const navigate = useNavigate(); //路由跳转的
  let [list, setList] = useState([]); //为数组 轮播图
  let [hoplist, setHoplist] = useState([])
  
  useEffect(() => {
    (async () => {
      let data = await banner({ hospitalId: 1 });
      // console.log(data);
      setList([...data.data.data]);
      // 获取医院列表的数据
      let hoplist = await hospitallist()
      console.log(hoplist, "医院列表");
      setHoplist([...hoplist.data.rows])

    })();
  }, []);
  useEffect(() => {
    console.log(list, "afkasfks1");
    console.log(hoplist,"lalallalalflalf");
  }, [list,hoplist]);
  return (
    <div>
      <NavBar
        onBack={() => {
          navigate("/");
        }}
        className={style.font}
      >
        门诊预约
      </NavBar>
      <Banner list={list}></Banner>
      {/* 轮播图的 */}
      <div className={style.line}>
        <Divider
          style={{
            color: "#1677ff",
            borderColor: "#1677ff",
            // borderStyle: "dashed",
          }}
        ></Divider>
      </div>
      <Cardlist hoplist={hoplist}></Cardlist> 
    </div>
  );
}
